
define([
    "jquery",
    "IO",
    "jqueryUI",
    "bootbox",
    //"text!/js/biz/keb/activity/definebt.html"
], function ($, IO, jui, bootbox, definebt) {

    $(document).on("click",".publish",function(){

        var num=$("#num").val();
        if(num<=0||num>100)
            return;

        bootbox.confirm("确定要生成"+num+"个邀请码吗",function(result){
            if(result) {
                IO.post("/api/genInvite",{num:num},function(d){
                    console.log(d);
                    var codes=[]
                    $.each(d,function(index,ele){
                        codes.push(ele.code);
                        console.log(d)
                    });
                    $("#content").text(codes.join("\n"))
                    //bootbox.alert(d.msg,function(){
                    //    //if (d.code == 0) {
                    //    //    location.href = '/pte/course';
                    //    //}
                    //})
                });
            }
        });
    })
});

